<?php
if (isset($_GET['status'])) {
  $orderStatus = $_GET['status'];
  require('includes/templates/tpl_facturar.php');
} else { // Select status

require('includes/application_top.php');
?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
<script language="javascript" src="includes/menu.js"></script>
<script language="javascript" src="includes/general.js"></script>
<script type="text/javascript">
  <!--
  function init()
  {
    cssjsmenu('navbar');
    if (document.getElementById)
    {
      var kill = document.getElementById('hoverJS');
      kill.disabled = true;
    }
  }
  // -->
</script>
</head>
<body onLoad="init()">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
<!-- body_text //-->

    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td>
          <p>This allows you to produce a report that will print all invoices for a given Order Status.</p>
          <p>The report will display as one continuous file, but when printed each invoice will start on a seperate page.</p>

          <form style="margin-left: 20px;" action="facturar.php" method="get" target="_new">
          <select name="status">
          <?php
            $orders_status = $db->Execute("SELECT orders_status_id, orders_status_name
                                           FROM " . TABLE_ORDERS_STATUS . "
                                           WHERE language_id = '" . (int)$_SESSION['languages_id'] . "'");
            while (!$orders_status->EOF) {
              echo '<option value="'.$orders_status->fields['orders_status_id'].'">'.$orders_status->fields['orders_status_name'].'</option>'."\n";
              $orders_status->MoveNext();
            }
          ?>
          </select>
          <input type="submit" value="Generate">
          </form>
        </td>
      </tr>
    </table></td>

<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php

require(DIR_WS_INCLUDES . 'application_bottom.php');

} // Select status
?>